package ace.module.oauth2.server.api.model.dto;

import io.swagger.v3.oas.annotations.media.Schema;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import jakarta.validation.constraints.*;
import jakarta.annotation.Nullable;
import java.io.Serializable;

/**
* 客户端认证的令牌 data transform object.
*
* @author Caspar
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Schema(title = Oauth2AuthorizationDto.TABLE_DESC)
public class Oauth2AuthorizationDto implements Serializable {

  public static final String TABLE_NAME = "oauth2_authorization";
  public static final String TABLE_DESC = "客户端认证的令牌";
  public static final String ID_COLUMN_NAME = "id";
  public static final String ID_TITLE = "id";
  public static final String ID_DESC = "";
  public static final String REGISTERED_CLIENT_ID_COLUMN_NAME = "registered_client_id";
  public static final String REGISTERED_CLIENT_ID_TITLE = "已注册的客户端id";
  public static final String REGISTERED_CLIENT_ID_DESC = "";
  public static final String PRINCIPAL_NAME_COLUMN_NAME = "principal_name";
  public static final String PRINCIPAL_NAME_TITLE = "认证名称";
  public static final String PRINCIPAL_NAME_DESC = "";
  public static final String AUTHORIZATION_GRANT_TYPE_COLUMN_NAME = "authorization_grant_type";
  public static final String AUTHORIZATION_GRANT_TYPE_TITLE = "授权方式";
  public static final String AUTHORIZATION_GRANT_TYPE_DESC = "";
  public static final String AUTHORIZATION_SCOPES_COLUMN_NAME = "authorization_scopes";
  public static final String AUTHORIZATION_SCOPES_TITLE = "授权范围";
  public static final String AUTHORIZATION_SCOPES_DESC = "";
  public static final String ATTRIBUTES_COLUMN_NAME = "attributes";
  public static final String ATTRIBUTES_TITLE = "授权扩展属性";
  public static final String ATTRIBUTES_DESC = "";
  public static final String STATE_COLUMN_NAME = "state";
  public static final String STATE_TITLE = "授权state";
  public static final String STATE_DESC = "";
  public static final String AUTHORIZATION_CODE_VALUE_COLUMN_NAME = "authorization_code_value";
  public static final String AUTHORIZATION_CODE_VALUE_TITLE = "授权code";
  public static final String AUTHORIZATION_CODE_VALUE_DESC = "";
  public static final String AUTHORIZATION_CODE_ISSUED_AT_COLUMN_NAME = "authorization_code_issued_at";
  public static final String AUTHORIZATION_CODE_ISSUED_AT_TITLE = "授权code发布时间";
  public static final String AUTHORIZATION_CODE_ISSUED_AT_DESC = "单位时间-秒";
  public static final String AUTHORIZATION_CODE_EXPIRES_AT_COLUMN_NAME = "authorization_code_expires_at";
  public static final String AUTHORIZATION_CODE_EXPIRES_AT_TITLE = "授权code过期时间";
  public static final String AUTHORIZATION_CODE_EXPIRES_AT_DESC = "单位时间-秒";
  public static final String AUTHORIZATION_CODE_METADATA_COLUMN_NAME = "authorization_code_metadata";
  public static final String AUTHORIZATION_CODE_METADATA_TITLE = "授权code元数据";
  public static final String AUTHORIZATION_CODE_METADATA_DESC = "";
  public static final String ACCESS_TOKEN_VALUE_COLUMN_NAME = "access_token_value";
  public static final String ACCESS_TOKEN_VALUE_TITLE = "授权access token";
  public static final String ACCESS_TOKEN_VALUE_DESC = "";
  public static final String ACCESS_TOKEN_ISSUED_AT_COLUMN_NAME = "access_token_issued_at";
  public static final String ACCESS_TOKEN_ISSUED_AT_TITLE = "授权access token发布时间";
  public static final String ACCESS_TOKEN_ISSUED_AT_DESC = "单位时间-秒";
  public static final String ACCESS_TOKEN_EXPIRES_AT_COLUMN_NAME = "access_token_expires_at";
  public static final String ACCESS_TOKEN_EXPIRES_AT_TITLE = "授权access token过期时间";
  public static final String ACCESS_TOKEN_EXPIRES_AT_DESC = "单位时间-秒";
  public static final String ACCESS_TOKEN_METADATA_COLUMN_NAME = "access_token_metadata";
  public static final String ACCESS_TOKEN_METADATA_TITLE = "授权access token元数据";
  public static final String ACCESS_TOKEN_METADATA_DESC = "";
  public static final String ACCESS_TOKEN_TYPE_COLUMN_NAME = "access_token_type";
  public static final String ACCESS_TOKEN_TYPE_TITLE = "access token类型";
  public static final String ACCESS_TOKEN_TYPE_DESC = "";
  public static final String ACCESS_TOKEN_SCOPES_COLUMN_NAME = "access_token_scopes";
  public static final String ACCESS_TOKEN_SCOPES_TITLE = "access token授权范围";
  public static final String ACCESS_TOKEN_SCOPES_DESC = "";
  public static final String OIDC_ID_TOKEN_VALUE_COLUMN_NAME = "oidc_id_token_value";
  public static final String OIDC_ID_TOKEN_VALUE_TITLE = "授权oidcId token";
  public static final String OIDC_ID_TOKEN_VALUE_DESC = "";
  public static final String OIDC_ID_TOKEN_ISSUED_AT_COLUMN_NAME = "oidc_id_token_issued_at";
  public static final String OIDC_ID_TOKEN_ISSUED_AT_TITLE = "授权oidcId token发布时间";
  public static final String OIDC_ID_TOKEN_ISSUED_AT_DESC = "单位时间-秒";
  public static final String OIDC_ID_TOKEN_EXPIRES_AT_COLUMN_NAME = "oidc_id_token_expires_at";
  public static final String OIDC_ID_TOKEN_EXPIRES_AT_TITLE = "授权oidcId token过期时间";
  public static final String OIDC_ID_TOKEN_EXPIRES_AT_DESC = "单位时间-秒";
  public static final String OIDC_ID_TOKEN_METADATA_COLUMN_NAME = "oidc_id_token_metadata";
  public static final String OIDC_ID_TOKEN_METADATA_TITLE = "授权oidcId token元数据";
  public static final String OIDC_ID_TOKEN_METADATA_DESC = "";
  public static final String REFRESH_TOKEN_VALUE_COLUMN_NAME = "refresh_token_value";
  public static final String REFRESH_TOKEN_VALUE_TITLE = "授权refresh token";
  public static final String REFRESH_TOKEN_VALUE_DESC = "";
  public static final String REFRESH_TOKEN_ISSUED_AT_COLUMN_NAME = "refresh_token_issued_at";
  public static final String REFRESH_TOKEN_ISSUED_AT_TITLE = "授权refresh token发布时间";
  public static final String REFRESH_TOKEN_ISSUED_AT_DESC = "单位时间-秒";
  public static final String REFRESH_TOKEN_EXPIRES_AT_COLUMN_NAME = "refresh_token_expires_at";
  public static final String REFRESH_TOKEN_EXPIRES_AT_TITLE = "授权refresh token过期时间";
  public static final String REFRESH_TOKEN_EXPIRES_AT_DESC = "单位时间-秒";
  public static final String REFRESH_TOKEN_METADATA_COLUMN_NAME = "refresh_token_metadata";
  public static final String REFRESH_TOKEN_METADATA_TITLE = "授权refresh token元数据";
  public static final String REFRESH_TOKEN_METADATA_DESC = "";
  public static final String DELETE_FLAG_COLUMN_NAME = "delete_flag";
  public static final String DELETE_FLAG_TITLE = "删除标志";
  public static final String DELETE_FLAG_DESC = "0-未删除";
  public static final String CREATE_TIME_COLUMN_NAME = "create_time";
  public static final String CREATE_TIME_TITLE = "创建时间";
  public static final String CREATE_TIME_DESC = "单位-毫秒";
  public static final String UPDATE_TIME_COLUMN_NAME = "update_time";
  public static final String UPDATE_TIME_TITLE = "更新时间";
  public static final String UPDATE_TIME_DESC = "单位-毫秒";
  public static final String ROW_VERSION_COLUMN_NAME = "row_version";
  public static final String ROW_VERSION_TITLE = "版本号和乐观锁";
  public static final String ROW_VERSION_DESC = "";

  @Size(max = 255)
  @Schema(title = ID_TITLE, description = ID_DESC)
  private String id;

  @Size(max = 255)
  @Schema(title = REGISTERED_CLIENT_ID_TITLE, description = REGISTERED_CLIENT_ID_DESC)
  private String registeredClientId;

  @Size(max = 255)
  @Schema(title = PRINCIPAL_NAME_TITLE, description = PRINCIPAL_NAME_DESC)
  private String principalName;

  @Size(max = 255)
  @Schema(title = AUTHORIZATION_GRANT_TYPE_TITLE, description = AUTHORIZATION_GRANT_TYPE_DESC)
  private String authorizationGrantType;

  @Schema(title = AUTHORIZATION_SCOPES_TITLE, description = AUTHORIZATION_SCOPES_DESC)
  private String authorizationScopes;

  @Schema(title = ATTRIBUTES_TITLE, description = ATTRIBUTES_DESC)
  private String attributes;

  @Schema(title = STATE_TITLE, description = STATE_DESC)
  private String state;

  @Schema(title = AUTHORIZATION_CODE_VALUE_TITLE, description = AUTHORIZATION_CODE_VALUE_DESC)
  private String authorizationCodeValue;

  @Schema(title = AUTHORIZATION_CODE_ISSUED_AT_TITLE, description = AUTHORIZATION_CODE_ISSUED_AT_DESC)
  private Long authorizationCodeIssuedAt;

  @Schema(title = AUTHORIZATION_CODE_EXPIRES_AT_TITLE, description = AUTHORIZATION_CODE_EXPIRES_AT_DESC)
  private Long authorizationCodeExpiresAt;

  @Schema(title = AUTHORIZATION_CODE_METADATA_TITLE, description = AUTHORIZATION_CODE_METADATA_DESC)
  private String authorizationCodeMetadata;

  @Schema(title = ACCESS_TOKEN_VALUE_TITLE, description = ACCESS_TOKEN_VALUE_DESC)
  private String accessTokenValue;

  @Schema(title = ACCESS_TOKEN_ISSUED_AT_TITLE, description = ACCESS_TOKEN_ISSUED_AT_DESC)
  private Long accessTokenIssuedAt;

  @Schema(title = ACCESS_TOKEN_EXPIRES_AT_TITLE, description = ACCESS_TOKEN_EXPIRES_AT_DESC)
  private Long accessTokenExpiresAt;

  @Schema(title = ACCESS_TOKEN_METADATA_TITLE, description = ACCESS_TOKEN_METADATA_DESC)
  private String accessTokenMetadata;

  @Size(max = 255)
  @Schema(title = ACCESS_TOKEN_TYPE_TITLE, description = ACCESS_TOKEN_TYPE_DESC)
  private String accessTokenType;

  @Schema(title = ACCESS_TOKEN_SCOPES_TITLE, description = ACCESS_TOKEN_SCOPES_DESC)
  private String accessTokenScopes;

  @Schema(title = OIDC_ID_TOKEN_VALUE_TITLE, description = OIDC_ID_TOKEN_VALUE_DESC)
  private String oidcIdTokenValue;

  @Schema(title = OIDC_ID_TOKEN_ISSUED_AT_TITLE, description = OIDC_ID_TOKEN_ISSUED_AT_DESC)
  private Long oidcIdTokenIssuedAt;

  @Schema(title = OIDC_ID_TOKEN_EXPIRES_AT_TITLE, description = OIDC_ID_TOKEN_EXPIRES_AT_DESC)
  private Long oidcIdTokenExpiresAt;

  @Schema(title = OIDC_ID_TOKEN_METADATA_TITLE, description = OIDC_ID_TOKEN_METADATA_DESC)
  private String oidcIdTokenMetadata;

  @Schema(title = REFRESH_TOKEN_VALUE_TITLE, description = REFRESH_TOKEN_VALUE_DESC)
  private String refreshTokenValue;

  @Schema(title = REFRESH_TOKEN_ISSUED_AT_TITLE, description = REFRESH_TOKEN_ISSUED_AT_DESC)
  private Long refreshTokenIssuedAt;

  @Schema(title = REFRESH_TOKEN_EXPIRES_AT_TITLE, description = REFRESH_TOKEN_EXPIRES_AT_DESC)
  private Long refreshTokenExpiresAt;

  @Schema(title = REFRESH_TOKEN_METADATA_TITLE, description = REFRESH_TOKEN_METADATA_DESC)
  private String refreshTokenMetadata;

  @Size(max = 255)
  @Schema(title = DELETE_FLAG_TITLE, description = DELETE_FLAG_DESC)
  private String deleteFlag;

  @Schema(title = CREATE_TIME_TITLE, description = CREATE_TIME_DESC)
  private Long createTime;

  @Schema(title = UPDATE_TIME_TITLE, description = UPDATE_TIME_DESC)
  private Long updateTime;

  @Schema(title = ROW_VERSION_TITLE, description = ROW_VERSION_DESC)
  private Long rowVersion;

}